package cool.taomu.software.fig.web.controller;

import java.util.Arrays;
import java.util.List;

import com.google.gson.Gson;

import cool.taomu.software.fig.mqtt.broker.impl.IRpcPublish;
import cool.taomu.software.fig.rpc.RpcProxy;
import cool.taomu.software.fig.utils.RuntimeStateUtils.RuntimeState;
import cool.taomu.software.fig.web.core.Type;

public class WebSocketConteroller {

	@Type("monitor")
	public String monitor(String message) {
		IRpcPublish t = RpcProxy.<IRpcPublish>getInstance("192.168.1.222", IRpcPublish.class);
		List<RuntimeState> rslist = Arrays.asList(t.getRuntimeState());
		return new Gson().toJson(rslist);
	}

	@Type("run")
	public String codeRun(String message) {
		return "nil";
	}
}
